<?php

namespace app\admin\model\hotel;

use app\api\model\MemberVipCard;
use think\Model;

/**
 * Order
 */
class Order extends Model
{
    // 表名
    protected $name = 'hotel_order';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 字段类型转换
    protected $type = [
        'order_start_time' => 'timestamp:Y-m-d',
        'order_end_time'   => 'timestamp:Y-m-d',
        'create_time' => 'timestamp:Y-m-d H:i:s',

    ];


    public function hotelMember(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Member::class, 'hotel_member_id', 'id');
    }

    public function admin(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
    }

    public function hotel(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\hotel\Hotel::class, 'hotel_id', 'id');
    }

    public function member(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Member::class, 'member_id', 'id');
    }

    public function vipCard(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\vip\Card::class, 'vip_card_id', 'id');
    }


}